//
//  ThemeCollectionViewCell.m
//  IconMaster
//
//  Created by mac on 2017/7/25.
//  Copyright © 2017年 yangweiwei. All rights reserved.
//

#import "ThemeCollectionViewCell.h"

@implementation ThemeCollectionViewCell
- (id)initWithFrame:(CGRect)frame  
{  
    self = [super initWithFrame:frame];  
    if (self)  
    {  
        // 初始化时加载collectionCell.xib文件  
        NSArray *arrayOfViews = [[NSBundle mainBundle] loadNibNamed:@"ThemeCell" owner:self options:nil];  
        
        // 如果路径不存在，return nil  
        if (arrayOfViews.count < 1)  
        {  
            return nil;  
        }  
        // 如果xib中view不属于UICollectionViewCell类，return nil  
        if (![[arrayOfViews objectAtIndex:0] isKindOfClass:[UICollectionViewCell class]])  
        {  
            return nil;  
        }  
        // 加载nib  
        self = [arrayOfViews objectAtIndex:0];  
    }  
    return self;  
} 
 
- (void)cellWithData:(NSString *)string{

    [self.themeImgView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",BaseURLImage,string]] placeholderImage:nil completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
//        NSLog(@"self.themeImgView=%@, wide = %f, high = %f",self.themeImgView, image.size.width, image.size.height);
//        NSLog(@"%ld", (long)self.themeImgView.contentMode);
        self.themeImgView.layer.cornerRadius = 8.0f;
        self.themeImgView.layer.masksToBounds = YES;
    }];
}
@end
